local sk_le__luoshen = fk.CreateSkill {

  name = "sk_le__luoshen",

  tags = {  },

}



sk_le__luoshen:addEffect(fk.EventPhaseStart, {
  name = "sk_le__luoshen",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk_le__luoshen.name) and player.phase == Player.Start
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = {}
    local num = {}
    for i = 1, 13, 1 do
      table.insert(num, i)
    end
    while true do
      local judge = {
        who = player,
        reason = sk_le__luoshen.name,
        pattern = ".|"..table.concat(num, ","),
        skipDrop = true,
      }
      room:judge(judge)
      local card = judge.card
      table.insert(cards, card)
      if not table.removeOne(num, judge.card.number) then
        room:addPlayerMark(player, MarkEnum.AddMaxCardsInTurn, judge.card.number)
        break
      end
      if player.dead then
        break
      end
    end
    cards = table.filter(cards, function(c) return room:getCardArea(c.id) == Card.Processing end)
    if #cards > 0 then
      if player.dead then
        room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonJustMove, sk_le__luoshen.name, nil, true)
      else
        room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, sk_le__luoshen.name, nil, true, player)
      end
    end
  end,
})

return sk_le__luoshen